home *** CD-ROM | disk | FTP | other *** search
- Path: ni1.ni.net!usenet
- From: Tom Benoist <ben@ifx.com>
- Newsgroups: comp.sys.sgi.hardware,comp.lang.c++
- Subject: Re: Help with serial/tty2 communication (write ok, read NOT).
- Date: 28 Jan 1996 06:45:45 GMT
- Organization: Interactive Effects
- Message-ID: <4ef62p$8t2@ni1.ni.net>
- References: <4ebkuaINNdqp@retriever.cs.umbc.edu>
- NNTP-Posting-Host: mike.ifx.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; IRIX 5.2 IP22)
- X-URL: news:4ebkuaINNdqp@retriever.cs.umbc.edu
-
- Its pretty difficult to see what your doing wrong since,
- 1. you didnt show your ioctl setup.
- 2. You didnt mention if you understood the implications of O_NONBLOCK
- (ie...your reads return FALSE until a byte is available)
-
- In any case, the following works for most applications.....
-
- -Tom
-
-
-
- int port;
- struct termio t;
-
-
- port = open("/dev/ttyd2", O_RDWR | O_NDELAY, 0666);
- t.c_iflag = IGNBRK;
- t.c_oflag = 0;
-
- t.c_cflag = B38400 | CS8 | CREAD | CLOCAL;
- t.c_lflag = 0;
-
- t.c_cc[VMIN] = 1;
- t.c_cc[VTIME] = 1;
-
- t.c_iflag &=~(IXON | IXOFF | IXANY);
-
- ioctl(port, TCSETAW, &t);
-
-
- --
- _____________________________________________________________________
- Tom Benoist Email: ben@ifx.com
- Interactive Effects Amazon http://www.ifx.com/ie
-
-